<?php
/**
 * Created by PhpStorm.
 * User: iwm
 * Date: 2017/3/2
 * Time: 16:36
 */
namespace app\home\controller;

use app\home\model\page\management\DashangPage;
use app\home\model\page\management\DashangRecordPage;
use app\home\model\page\management\ManbiRulePage;
use app\home\model\page\management\RankRecommendPage;
use app\home\model\page\management\RecommandPage;
use app\home\model\page\shop\GetAdPosition;
use think\Controller;
use think\Request;

class Management extends Controller
{
    private $param;

    public function __construt()
    {
        $this->param = Request::instance()->param();
    }

    public function getAdPositionPage()
    {
        $obj = new GetAdPosition();
        $data = $obj->excute($this->param);
        //return JSON($data);
        $this->assign('data', $data['data']);
        return $this->fetch('home/pages/management/bannerlist');
    }

    public function recommendPage()
    {
        $obj = new RecommandPage();
        $data = $obj->excute($this->param);
        //return JSON($data);
        $this->assign('data', $data['data']);
        return $this->fetch('home/pages/management/recommand');
    }

    public function rankRecommandPage()
    {
        $obj = new RankRecommendPage();
        $ret = $obj->excute($this->param);
        //return JSON($ret);
        $this->assign('data', $ret['data']);
        return $this->fetch('home/pages/management/rankrecommand');
    }

    public function dashangPage()
    {
        $obj = new DashangPage();
        $ret = $obj->excute($this->param);
        //return JSON($ret);
        $this->assign('data', $ret['data']);
        return $this->fetch('home/pages/management/dashang');
    }

    public function dashangRecordPage()
    {
        $obj = new DashangRecordPage();
        $ret = $obj->excute($this->param);
        //return JSON($ret);
        $this->assign('data', $ret['data']);
        return $this->fetch('home/pages/management/dashangrecord');
    }

    /**
     * 推举
     *
     * @return array
     */
    public function addRecommendUser()
    {
        $obj = new \app\home\model\page\management\AddRecommendUser();
        $this->param = Request::instance()->param();
        $ret = $obj->excute($this->param);
        return json($ret);
    }

    /**
     * 推举
     *
     * @return array
     */
    public function delRecommendUser()
    {
        $obj = new \app\home\model\page\management\DelRecommendUser();
        $this->param = Request::instance()->param();
        $ret = $obj->excute($this->param);
        return json($ret);
    }

    /**
     * 推举
     *
     * @return array
     */
    public function addDashangGift()
    {
        $obj = new \app\home\model\page\management\AddDashangGift();
        $this->param = Request::instance()->param();
        $ret = $obj->excute($this->param);
        return json($ret);
    }

    /**
     * 推举
     *
     * @return array
     */
    public function updateDashangGift()
    {
        $obj = new \app\home\model\page\management\UpdateDashangGift();
        $this->param = Request::instance()->param();
        $ret = $obj->excute($this->param);
        return json($ret);
    }

    public function manbiRulePage()
    {
        $obj = new ManbiRulePage();
        $ret = $obj->excute($this->param);
        //return JSON($ret);
        $this->assign('data', $ret['data']);
        return $this->fetch('home/pages/management/manbirule');
    }
}